package com.jpf.service;

import java.util.ArrayList;
import java.util.List;

import com.jpf.dao.OrderDao;
import com.jpf.demo.Goods;
import com.jpf.demo.Order;
import com.jpf.demo.Page;

public class OrderService {
	OrderDao orderdao = null;
	public OrderService() {
		super();
		this.orderdao = new OrderDao();
	}
	public Order queryOrder(int oid) {//根据商品id查询
		return orderdao.queryOrder(oid);
	}
	public List<Order> queryOrder() {//查询全部
		return orderdao.queryOrder();
	}
	public boolean updateOrder(Order order) {//修改
		if(order.getStatus().equals("未发货"))
			order.setStatus("已发货");
		int result = orderdao.updateOrder(order);
		if (result > 0) {
			return true;
		}
		return false;
	}
	public boolean deleteOrder(Integer oid) {//删除
		int result = orderdao.deleteOrder(oid);
		if (result > 0) {
			return true;
		}
		return false;
	}
	public Page<Order> queryPage(Integer pageSize, Integer pageNow) {//分页
		return orderdao.queryPage(pageSize, pageNow);
	}
}
